package cn.fintecher.pangolin.service.common.web;
import cn.fintecher.pangolin.common.model.CuscdrFileModel;
import cn.fintecher.pangolin.service.common.service.UploadFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;


@RestController
@RequestMapping(value = "/api/smaController")
@Api(value = "呼叫相关接口", description = "呼叫相关接口")
public class SmaController {
    private static final Logger logger = LoggerFactory.getLogger(SmaController.class);

    @Autowired
    UploadFileService uploadFileService;

    @PostMapping("/downAudioFile")
    @ApiOperation(value = "云翳录音文件下载", notes = "云翳录音文件下载")
    public ResponseEntity downAudioFile(@RequestBody List<CuscdrFileModel> audioFiles){
        if(Objects.nonNull(audioFiles)){
            for(CuscdrFileModel fileModel:audioFiles){
                uploadFileService.downFileFromUrl(fileModel);
            }
        }
        return null;
    }
}
